$(function () {
    $('#lc-grid').datagrid({
        onLoadSuccess: function (target) {
            $("#lc-del").hide();
        },
        onClickRow: function (rowIndex, rowData) {
            $("#lc-del").show();
        }
    });
})

//删除
function lc_publishItem() {
    $.post($.webPath() + '/flow/publish/deploy', {'lc_name': $("#lc-name").combobox('getValue')}, function (data) {
        var obj = eval('(' + data + ')');
        if (obj.statusCode == '200')
            $('#lc-grid').datagrid('reload');
        else
            $.messager.alert("提示", obj.message, "info");
    });
}

//删除
function lc_destroyItem() {
    var row = $('#lc-grid').datagrid('getSelected');
    if (row) {
        $.messager.confirm('确认', '是否确认删除此流程?', function (r) {
            if (r) {
                var index = $('#lc-grid').datagrid('getRowIndex', row);
                $.post($.webPath() + '/flow/publish/delProcess', {deploymentId: row.deploymentId}, function (data) {
                    var obj = eval('(' + data + ')');
                    if (obj.statusCode == '200')
                        $('#lc-grid').datagrid('deleteRow', index);
                    else
                        $.messager.alert("提示", obj.message, "info");
                });
            }
        });
    } else {
        $.messager.alert("提示", "请选择要删除的流程", "info");
    }
}